package cn.lg.soar.system.biz.modules.general.client;

import cn.lg.soar.core.annotations.ApiClient;
import cn.lg.soar.system.api.constant.ModuleConst;
import cn.lg.soar.system.api.service.ISm2Api;
import cn.lg.soar.system.biz.modules.general.service.IPublicService;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author luguoxiang
 * @date 2022/1/16
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Hidden
@ApiClient("boot")
@RestController
@RequestMapping(ModuleConst.CLIENT_PATH + "/sm2")
public class Sm2ApiClient implements ISm2Api {

    @Autowired
    private IPublicService service;

    @GetMapping("publicKey")
    @Override
    public byte[] getPublicKey(@RequestParam("bizType") String bizType) {
        return service.getSM2PublicKey(bizType);
    }

    @GetMapping("privateKey")
    @Override
    public byte[] getPrivateKey(@RequestParam("bizType") String bizType) {
        return service.getSM2PrivateKey(bizType);
    }

}
